package ysq.xyg.web.controller;import cn.hutool.core.bean.BeanUtil;import cn.hutool.core.date.DatePattern;import cn.hutool.core.date.DateUtil;import com.alibaba.fastjson.JSONObject;import com.github.pagehelper.StringUtil;import org.apache.commons.lang3.StringUtils;import org.iherus.codegen.qrcode.SimpleQrcodeGenerator;import org.slf4j.Logger;import org.slf4j.LoggerFactory;import org.springframework.beans.factory.annotation.Autowired;import org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RequestMethod;import org.springframework.web.bind.annotation.RequestParam;import org.springframework.web.bind.annotation.ResponseBody;import org.springframework.web.multipart.MultipartFile;import org.springframework.web.servlet.ModelAndView;import ysq.xyg.base.controller.BaseController;import ysq.xyg.base.extend.ehcache.EhCacheService;import ysq.xyg.base.extend.ehcache.EhcacheUtils;import ysq.xyg.base.model.dto.ReturnEntity;import ysq.xyg.base.util.BaseConstant;import ysq.xyg.base.util.BaseUtil;import ysq.xyg.base.util.ProProperties;import ysq.xyg.base.util.QrcodeUtil;import ysq.xyg.base.util.httpClient.HttpUtil;import ysq.xyg.gaodeapi.GaoDeApi;import ysq.xyg.recovery.model.po.*;import ysq.xyg.recovery.model.vo.*;import ysq.xyg.recovery.service.*;import ysq.xyg.shop.model.po.*;import ysq.xyg.shop.model.vo.ShopAddressVo;import ysq.xyg.shop.model.vo.ShopItemVo;import ysq.xyg.shop.model.vo.ShopOrderVo;import ysq.xyg.shop.model.vo.ShopWithdrawVo;import ysq.xyg.shop.service.ShopAddressService;import ysq.xyg.shop.service.ShopItemService;import ysq.xyg.shop.service.ShopOrderService;import ysq.xyg.shop.service.ShopWithdrawService;import ysq.xyg.sys.model.po.SysConfig;import ysq.xyg.sys.service.SysConfigService;import ysq.xyg.sys.service.SysDictContentService;import ysq.xyg.sys.service.SysFileService;import ysq.xyg.web.model.dto.AddressDTO;import ysq.xyg.web.model.dto.AddressDataDTO;import ysq.xyg.web.model.po.*;import ysq.xyg.web.model.vo.WebArticleVo;import ysq.xyg.web.model.vo.WebMemberVo;import ysq.xyg.web.model.vo.WebShareVo;import ysq.xyg.web.service.*;import ysq.xyg.wxapi.api.WxApiClient;import ysq.xyg.wxapi.api.WxMemoryCacheClient;import ysq.xyg.wxapi.model.base.JSTicketShareResponse;import ysq.xyg.wxapi.model.base.TemplateMessage;import javax.servlet.http.HttpServletRequest;import java.io.*;import java.util.*;@Controller@RequestMapping("/phone")public class PhoneController extends BaseController {    private static java.util.logging.Logger log= java.util.logging.Logger.getLogger(PhoneController.class.getName());    private static final Logger LOGGER = LoggerFactory.getLogger(PhoneController.class);    @Autowired    private SysFileService sysFileService;    @Autowired    private WebMemberService webMemberService;    @Autowired    private EhCacheService ehCacheService;    @Autowired    private ShopItemService shopItemService;    @Autowired    private WebArticleService webArticleService;    @Autowired    private WebAddressService webAddressService;    @Autowired    private RecoveryCallOutService recoveryCallOutService;    @Autowired    private RecoveryProposeService recoveryProposeService;    @Autowired    private RecoveryRecordService recoveryRecordService;    @Autowired    private SysConfigService sysConfigService;    @Autowired    private WebShareService webShareService;    @Autowired    private WebUnionidService webUnionidService;    @Autowired    private WebArticleTypeService webArticleTypeService;    @Autowired    private ShopAddressService shopAddressService;    @Autowired    private ShopWithdrawService shopWithdrawService;    @Autowired    private RecoverySackMemberService recoverySackMemberService;    @Autowired    private RecoverySackRecordService recoverySackRecordService;    @Autowired    private RecoverySackService recoverySackService;    @Autowired    private RecoverySackDetailService recoverySackDetailService;    @Autowired    private RecoveryOrderService recoveryOrderService;    @Autowired    private RecoveryCircleService recoveryCircleService;    @Autowired    private RecoveryCircleOrderService recoveryCircleOrderService;    @Autowired    private RecoveryWasteMemberService recoveryWasteMemberService;    @Autowired    private RecoveryComplainService recoveryComplainService;    @Autowired    private SysDictContentService sysDictContentService;    @Autowired    private ShopOrderService shopOrderService;    @Autowired    private RecoveryLargeCatService recoveryLargeCatService;    private ModelAndView checkModelAndView;    /**     * 个人信息修改     */    @RequestMapping(value = "/sendMsg")    public @ResponseBody JSONObject sendMsg(String type) {        if("1".equals(type)){            //预约提醒            TemplateMessage templateMessage=new TemplateMessage();            templateMessage.setUrl("");            templateMessage.setOpenid("osJjP5yNFs9TXFby5Q-3R9Q3ysXk");            templateMessage.setTemplateId("RjlsC46UYLHJbaA1LhARw43sCIHLjIMinZg2z4ZjvsA");            Map<String,String> data=new HashMap<String, String>();            data.put("first","您有一个用户预约");            data.put("keyword1","张三");            data.put("keyword2","18949404987");            data.put("keyword3","2019-11-20 10:00:03");            data.put("keyword4","垃圾回收");            data.put("remark","备注：请尽快查处理");            templateMessage.setDataMap(data);            return WxApiClient.sendTempletNotice(templateMessage);        }else if("2".equals(type)){            //预约提醒            TemplateMessage templateMessage=new TemplateMessage();            templateMessage.setUrl("");            templateMessage.setOpenid("osJjP5yNFs9TXFby5Q-3R9Q3ysXk");            templateMessage.setTemplateId("gZOTfW30xhYD21x5cfTlXEC6L9asujq3mjhzdGWllPo");            Map<String,String> data=new HashMap<String, String>();            data.put("first","您有一个用户李四，兑换的商品");            data.put("keyword1","洗衣机一台");            data.put("keyword2","190个积分");            data.put("keyword3","2019-11-20 10:00:03");            data.put("keyword4","无");            data.put("remark","备注：请尽快查处理");            templateMessage.setDataMap(data);            return WxApiClient.sendTempletNotice(templateMessage);        }else {            //预约提醒            TemplateMessage templateMessage=new TemplateMessage();            templateMessage.setUrl("");            templateMessage.setOpenid("osJjP5yNFs9TXFby5Q-3R9Q3ysXk");            templateMessage.setTemplateId("ouGM0xpEXP4VBp-ePNa06b_PRyCgG_H3QeMI_iNtez0");            Map<String,String> data=new HashMap<String, String>();            data.put("first","您有一个用户提现");            data.put("keyword1","张三");            data.put("keyword2","2019-11-20 10:00:03");            data.put("keyword3","200元");            data.put("keyword4","微信");            data.put("remark","备注：请尽快查处理");            templateMessage.setDataMap(data);            return WxApiClient.sendTempletNotice(templateMessage);        }    }    /**     * 付款码     */    @RequestMapping("/paymentCode")    public ModelAndView paymentCode(HttpServletRequest request, @RequestParam(required = false) String memberId) {        WebAccount webAccount=WxMemoryCacheClient.getSingleWxAccountInfo();        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        // 判断是否已拥有二维码        boolean flag = false;        if (StringUtils.isEmpty(webMember.getQrCode())) {            flag = true;            //String url = webAccount.getBaseUrl()+ProProperties.getInstance().getRecoveryQrCodeScanUrl()+webMember.getId();            String realPath = HttpUtil.getRealPath(request);            String path = realPath+"/upload/khao/" + webMember.getId() + ".png";            File dicFile = new File(realPath+"/upload/khao/");            if  (!dicFile .exists()  && !dicFile .isDirectory()) {                dicFile .mkdir();            }            try {                OutputStream out = new FileOutputStream(path);                new SimpleQrcodeGenerator().generate(webMember.getCardNo()).toStream(out);                webMember.setQrCode("/upload/khao/" + webMember.getId() + ".png");            } catch (FileNotFoundException e) {                e.printStackTrace();            } catch (IOException e) {                e.printStackTrace();            }        }        if (StringUtils.isEmpty(webMember.getBarCode())) {            flag = true;            String realPath = HttpUtil.getRealPath(request);            // File file = new File(realPath + "/upload/khao/" + webMember.getCardNo() + ".png");            //如果文件夹不存在则创建            File dicFile =new File(realPath+"/upload/khao/");            if  (!dicFile .exists()  && !dicFile .isDirectory()) {                dicFile .mkdir();            }            String path = realPath+"/upload/khao/" + webMember.getCardNo() + ".png";            QrcodeUtil.encode(webMember.getCardNo(), 150, 40,  path);            webMember.setBarCode("/upload/khao/" + webMember.getCardNo() + ".png");        }        if (flag) {            webMember.setNickName(null);            webMemberService.updateByPrimaryKeySelective(webMember);        }        ModelAndView modelAndView = new ModelAndView("/mobile/paymentCode");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember",  webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 首页     * */    @RequestMapping("/index")    public ModelAndView index( HttpServletRequest request,@RequestParam(required = false) String memberId) throws IOException {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        // banner        List<ShopBanner> shopBannerList = EhcacheUtils.selectShopBannerByTypeList("1");        // 通知公告        WebArticleVo webArticleVo = new WebArticleVo();        webArticleVo.setRemoveTag(BaseConstant.BASE_REMOVE_TAG_NORMAL);        // 此项是通知公告分类，不可修改        webArticleVo.setTypeId("20190802204911027339575973147180");        List<WebArticle> webArticleList = webArticleService.acceptList(webArticleVo);        ModelAndView modelAndView = new ModelAndView("/mobile/index");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webArticleList", webArticleList);        modelAndView.addObject("shopBannerList", shopBannerList);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 我的     */    @RequestMapping("/my")    public ModelAndView my(HttpServletRequest request,@RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/my");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        int sumNum = recoveryOrderService.selectSumNum(memberId);        modelAndView.addObject("consumeCount", sumNum);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 个人资料     */    @RequestMapping("/memberEdit")    public ModelAndView memberEdit(HttpServletRequest request, @RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        WebAddress webAddressRecord = new WebAddress();        webAddressRecord.setRemoveTag(BaseConstant.BASE_REMOVE_TAG_NORMAL);        ModelAndView modelAndView = new ModelAndView("/mobile/memberEdit");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 个人信息修改     */    @RequestMapping(value = "/webMemberUpdate",method = RequestMethod.POST)    public @ResponseBody ReturnEntity webMemberUpdate(WebMemberVo webMemberVo) {        WebMember webMember = webMemberService.selectByPrimaryKey(webMemberVo.getId());        webMember.setPhone(webMemberVo.getPhone());        webMember.setName(webMemberVo.getName());        webMember.setAddressName(webMemberVo.getAddressName());        webMemberService.updateByPrimaryKey(webMember);        return new ReturnEntity();    }    /**     * 公益宣传     */    @RequestMapping("/gyxc")    public ModelAndView gyxc(HttpServletRequest request,@RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/gyxc");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 积分商城     * */    @RequestMapping("/jfsc")    public ModelAndView jfsc( HttpServletRequest request, @RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        // banner        List<ShopBanner> shopBannerList = EhcacheUtils.selectShopBannerByTypeList("2");        ModelAndView modelAndView = new ModelAndView("/mobile/jfsc");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("shopBannerList", shopBannerList);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 积分商城详情页面     * */    @RequestMapping("/productDesc")    public ModelAndView productDesc( HttpServletRequest request, @RequestParam(required = false) String memberId, String id) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ShopItem shopItem = shopItemService.selectByPrimaryKey(id);        ModelAndView modelAndView = new ModelAndView("/mobile/productDesc");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("shopItem", shopItem);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 积分商城json数据     */    @RequestMapping(value = "/jfscJsonList", method = RequestMethod.POST)    public @ResponseBody ReturnEntity jfscJsonList(ShopItemVo shopItemVo, int pageSize, int pageNum) {        ReturnEntity returnEntity = shopItemService.page(shopItemVo, pageSize, pageNum);        return returnEntity;    }    /**     * 兑换商品     */    @RequestMapping(value = "/shoporder/orderSave", method = RequestMethod.POST)    public @ResponseBody ReturnEntity shopOrderSave(String itemId, String memberId, String memberName, String memberPhone, String memberAddress) {        ReturnEntity returnEntity = shopOrderService.shopOrderSave(itemId, memberId, memberName, memberPhone, memberAddress);        return returnEntity;    }    /**     * 积分订单页面     */    @RequestMapping("/shopOrderList")    public ModelAndView shopOrderList( HttpServletRequest request, @RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/shopOrderList");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 积分下单     */    @RequestMapping("/shopOrderEdit")    public ModelAndView shopOrderEdit( HttpServletRequest request, @RequestParam(required = false) String memberId, String itemId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ShopItem shopItem = shopItemService.selectByPrimaryKey(itemId);        ModelAndView modelAndView = new ModelAndView("/mobile/shopOrderEdit");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("shopItem", shopItem);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 积分订单详情     */    @RequestMapping("/shopOrderShow")    public ModelAndView shopOrderShow( HttpServletRequest request, @RequestParam(required = false) String memberId, String id) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ShopOrder shopOrder = shopOrderService.selectByPrimaryKey(id);        ModelAndView modelAndView = new ModelAndView("/mobile/shopOrderShow");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("shopOrder", shopOrder);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 商城订单json数据     */    @RequestMapping(value = "/shopOrderJsonList", method = RequestMethod.POST)    public @ResponseBody ReturnEntity shopOrderJsonList(ShopOrderVo shopOrderVo, int pageSize, int pageNum) {        ReturnEntity returnEntity = shopOrderService.page(shopOrderVo, pageSize, pageNum);        return returnEntity;    }    /**     * 积分列表     */    @RequestMapping("/recoveryRecordIntegralList")    public ModelAndView recoveryRecordIntegralList( HttpServletRequest request, @RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/recoveryRecordIntegralList");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 商城订单json数据     */    @RequestMapping(value = "/recoveryRecordIntegralJsonList", method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoveryRecordIntegralJsonList(RecoveryRecordVo recoveryRecordVo, int pageSize, int pageNum) {        ReturnEntity returnEntity = recoveryRecordService.pageByIntegral(recoveryRecordVo, pageSize, pageNum);        return returnEntity;    }    /**     * code码数据     */    @RequestMapping(value = "/sysDictContent/listByDictTypes")    public @ResponseBody ReturnEntity listByDictTypes(String dictTypes){        return sysDictContentService.listByDictTypes(dictTypes);    }    /**     * 回收商圈     */    @RequestMapping("/hssq")    public ModelAndView hssq(HttpServletRequest request, @RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        WebAddress webAddressRecord = new WebAddress();        webAddressRecord.setRemoveTag(BaseConstant.BASE_REMOVE_TAG_NORMAL);        ModelAndView modelAndView = new ModelAndView("/mobile/hssq");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    @RequestMapping("/hssqMember")    public ModelAndView hssqMember(HttpServletRequest request, @RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        WebAddress webAddressRecord = new WebAddress();        webAddressRecord.setRemoveTag(BaseConstant.BASE_REMOVE_TAG_NORMAL);        ModelAndView modelAndView = new ModelAndView("/mobile/hssqMember");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 加入收费员     */    @RequestMapping("/jrsfy")    public ModelAndView jrsfy(HttpServletRequest request, @RequestParam(required = false) String memberId,String latlong) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        // 判断是否是收费员        RecoveryWasteMemberVo wasteMemberRecord = new RecoveryWasteMemberVo();        wasteMemberRecord.setRemoveTag(BaseConstant.BASE_REMOVE_TAG_NORMAL);        wasteMemberRecord.setMemberId(memberId);        wasteMemberRecord.setStatus(BaseConstant.RECOVERY_WASTE_MEMBER_STATUS_FOUR);        List<RecoveryWasteMember> recoveryWasteMemberList = recoveryWasteMemberService.acceptList(wasteMemberRecord);        ModelAndView modelAndView;        if (recoveryWasteMemberList != null && recoveryWasteMemberList.size() > 0) {            modelAndView = new ModelAndView("/mobile/wasteMemberShow");            modelAndView.addObject("recoveryWasteMember", recoveryWasteMemberList.get(0));        } else {            modelAndView = new ModelAndView("/mobile/jrsfy");        }        modelAndView.addObject("latlong", latlong);        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 根据id查看收废员审核     */    @RequestMapping("/wasteMemberShow")    public ModelAndView wasteMemberShow(HttpServletRequest request, @RequestParam(required = false) String memberId, String id) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        // 判断是否是收费员        RecoveryWasteMember wasteMember = recoveryWasteMemberService.selectByPrimaryKey(id);        ModelAndView modelAndView = new ModelAndView("/mobile/wasteMemberShow");        modelAndView.addObject("recoveryWasteMember", wasteMember);        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 收废员列表     */    @RequestMapping("/wasteMemberList")    public ModelAndView wasteMemberList(HttpServletRequest request, @RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        // 判断是否是收费员        ModelAndView modelAndView = new ModelAndView("/mobile/wasteMemberList");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        RecoveryWasteMember wasteMemberRecord = new RecoveryWasteMember();        wasteMemberRecord.setRemoveTag(BaseConstant.BASE_REMOVE_TAG_NORMAL);        wasteMemberRecord.setMemberId(memberId);        List<RecoveryWasteMember> recoveryWasteMemberList = recoveryWasteMemberService.select(wasteMemberRecord);        modelAndView.addObject("jSTicketShareResponse", Share(request));        modelAndView.addObject("recoveryWasteMemberList", recoveryWasteMemberList);        return modelAndView;    }    /**     * 企业下单     */    @RequestMapping("/qyxd")    public ModelAndView qyxd(HttpServletRequest request, @RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/qyxd");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 回收商圈订单限时     * type=1是从首页订单进入     * type=2是从我的页面订单进入     */    @RequestMapping("/circleOrderShow")    public ModelAndView circleOrderShow(HttpServletRequest request, @RequestParam(required = false) String memberId, String id, String type) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        RecoveryCircleOrder recoveryCircleOrder = recoveryCircleOrderService.selectByPrimaryKey(id);        ModelAndView modelAndView = new ModelAndView("/mobile/circleOrderShow");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("type", type);        modelAndView.addObject("recoveryCircleOrder", recoveryCircleOrder);        String image = recoveryCircleOrder.getImage();        if (StringUtils.isNotEmpty(image)) {            String[] imageArr = image.split(",");            modelAndView.addObject("imageArr", imageArr);        }        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 收费价格     */    @RequestMapping("/sfjg")    public ModelAndView sfjg(HttpServletRequest request, @RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        // 分类，价格和涨幅价格        List<RecoveryLargeCat> recoveryLargeCatList = ehCacheService.selectRecoveryLargeCatList();        ModelAndView modelAndView = new ModelAndView("/mobile/sfjg");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        if (recoveryLargeCatList != null && recoveryLargeCatList.size() > 0) {            RecoveryLargeCat recoveryLargeCat = recoveryLargeCatList.get(0);            List<RecoveryMiddleCat> recoveryMiddleCatList = EhcacheUtils.selecOnlyRecoveryMiddleByLargeIdList(recoveryLargeCat.getId());            modelAndView.addObject("recoveryMiddleCatList", recoveryMiddleCatList);        }        modelAndView.addObject("recoveryLargeCatList", recoveryLargeCatList);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 回收商圈入驻     */    @RequestMapping("/recoveryCircleEdit")    public ModelAndView recoveryCircle(HttpServletRequest request, @RequestParam(required = false) String memberId,String latlong) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        WebAddress webAddressRecord = new WebAddress();        webAddressRecord.setRemoveTag(BaseConstant.BASE_REMOVE_TAG_NORMAL);        List<WebAddress> webAddressList = webAddressService.select(webAddressRecord);        ModelAndView modelAndView = new ModelAndView("mobile/recoveryCircleEdit");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("latlong", latlong);        if (webAddressList != null && webAddressList.size() > 0) {            modelAndView.addObject("webAddress", webAddressList.get(0));        }        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 回收商圈查看     */    @RequestMapping("/recoveryCircleShow")    public ModelAndView recoveryCircleShow(HttpServletRequest request, @RequestParam(required = false) String memberId, String id) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        RecoveryCircle recoveryCircle = recoveryCircleService.selectByPrimaryKey(id);        ModelAndView modelAndView = new ModelAndView("mobile/recoveryCircleShow");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        if (recoveryCircle != null) {            String area = recoveryCircle.getArea();            WebAddress webAddress = webAddressService.selectByPrimaryKey(area);            recoveryCircle.setAreaName(webAddress.getArea());            String image = recoveryCircle.getImage();            if (StringUtils.isNotEmpty(image)) {                String[] imageArr = image.split(",");                modelAndView.addObject("imageArr", imageArr);            }        }        modelAndView.addObject("recoveryCircle", recoveryCircle);        // 需要地址名称        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 回收商圈订单     */    @RequestMapping("/circleOrderList")    public ModelAndView circleOrderList(HttpServletRequest request, @RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("mobile/circleOrderList");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 我的回收商圈订单     */    @RequestMapping("/circleOrderMemberList")    public ModelAndView circleOrderMemberList(HttpServletRequest request, @RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("mobile/circleOrderMemberList");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 管理员端根据用户新建的订单     */    @RequestMapping("/orderList")    public ModelAndView orderList(HttpServletRequest request, @RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("mobile/orderList");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 订单详情     */    @RequestMapping("/orderDetail")    public ModelAndView orderDetail(HttpServletRequest request,@RequestParam(required = false) String memberId, String recordId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/orderDetail");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        RecoverySackRecord sackRecord = recoverySackRecordService.selectByPrimaryKey(recordId);        if (sackRecord != null) {            sackRecord.setCreateTimeStr(DateUtil.formatDateTime(sackRecord.getCreateTime()));        }        modelAndView.addObject("sackRecord", sackRecord);        if (sackRecord != null) {            // 详情            RecoverySackDetailVo recoverySackDetailVo = new RecoverySackDetailVo();            recoverySackDetailVo.setRemoveTag(BaseConstant.BASE_REMOVE_TAG_NORMAL);            recoverySackDetailVo.setRecordId(recordId);            List<RecoverySackDetail> sackDetailList = recoverySackDetailService.acceptList(recoverySackDetailVo);            // 计算金额            Double allPrice = 0.0d;            if (sackDetailList != null && sackDetailList.size() > 0) {                for (RecoverySackDetail sackDetail : sackDetailList) {                    if (StringUtils.isNotEmpty(sackDetail.getAllPrice())) {                        allPrice = allPrice + Double.parseDouble(sackDetail.getAllPrice());                    }                }            }            modelAndView.addObject("allPrice", allPrice);            modelAndView.addObject("sackDetailList", sackDetailList);        }        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 投诉保存     */    @RequestMapping(value = "/recoveryComplainSave",method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoveryComplainSave(HttpServletRequest request, RecoveryComplainVo recoveryComplainVo) {        ReturnEntity returnEntity = recoveryComplainService.addOrUpdate(request, recoveryComplainVo);        return returnEntity;    }    /**     * 回收商圈入驻保存     */    @RequestMapping(value = "/recoveryCircleSave",method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoveryCircleSave(RecoveryCircleVo recoveryCircleVo) {        ReturnEntity returnEntity = recoveryCircleService.addOrUpdate(recoveryCircleVo);        return returnEntity;    }    /**     * 回收商圈json     */    @RequestMapping(value = "/recoveryCircleJsonList",method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoveryCircleJsonList(RecoveryCircleVo recoveryCircleVo, int pageSize, int pageNum) {        ReturnEntity returnEntity = recoveryCircleService.pageLeft(recoveryCircleVo, pageSize, pageNum);        return returnEntity;    }    /**     * 回收商圈订单json     */    @RequestMapping(value = "/recoveryCircleOrderJsonList",method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoveryCircleOrderJsonList(RecoveryCircleOrderVo recoveryCircleOrderVo, int pageSize, int pageNum) {        ReturnEntity returnEntity = recoveryCircleOrderService.pageLeft(recoveryCircleOrderVo, pageSize, pageNum);        return returnEntity;    }    /**     * 投诉     */    @RequestMapping("/complain")    public ModelAndView complain(HttpServletRequest request, @RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/complain");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 中分类json数据     */    @RequestMapping(value = "/recoveryMiddleCatJsonList",method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoveryMiddleCatJsonList(String largeCatId) {        List<RecoveryMiddleCat> recoveryMiddleCatList = EhcacheUtils.selecOnlyRecoveryMiddleByLargeIdList(largeCatId);        ReturnEntity returnEntity = new ReturnEntity(recoveryMiddleCatList);        return returnEntity;    }    /**     * 小分类json数据     */    @RequestMapping(value = "/recoverySmallCatJsonList",method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoverySmallCatJsonList(String middleCatId) {        List<RecoverySmallCat> recoverySmallCatList = EhcacheUtils.selecRecoverySmallCatByMiddleIdList(middleCatId);        ReturnEntity returnEntity = new ReturnEntity(recoverySmallCatList);        return returnEntity;    }    /**     * 消费记录     */    @RequestMapping("/recoveryRecord")    public ModelAndView recoveryRecord(HttpServletRequest request,@RequestParam(required = false) String memberId) throws IOException {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/recoveryRecord");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        // 需要计算回收多少和消费多少        RecoveryRecord recoveryRecord = new RecoveryRecord();        recoveryRecord.setType("1");        recoveryRecord.setMemberId(memberId);        Double recoveryMoney = recoveryRecordService.selectAllCount(recoveryRecord);        recoveryRecord.setType("2");        Double consumeMoney = recoveryRecordService.selectAllCount(recoveryRecord);        modelAndView.addObject("recoveryMoney", recoveryMoney);        modelAndView.addObject("consumeMoney", consumeMoney);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 关于环保金     * 文章列表     */    @RequestMapping("/webArticleList")    public ModelAndView aboutRecovery(HttpServletRequest request,@RequestParam(required = false) String memberId) throws IOException {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        // banner图，文章用        List<ShopBanner> shopBannerList = EhcacheUtils.selectShopBannerByTypeList("2");        ModelAndView modelAndView = new ModelAndView("/mobile/webArticleList");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("shopBannerList", shopBannerList);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 文章列表json     */    @RequestMapping(value = "/webArticleJsonList",method = RequestMethod.POST)    public @ResponseBody ReturnEntity webArticleJsonList(WebArticleVo webArticleVo, int pageSize, int pageNum) {        webArticleVo.setEditType("1");        ReturnEntity returnEntity = webArticleService.page(webArticleVo, pageSize, pageNum);        return returnEntity;    }    /**     * 客服     */    @RequestMapping("/callCenter")    public ModelAndView customerServicePage(HttpServletRequest request,@RequestParam(required = false) String memberId, @RequestParam(required = false) String status) throws IOException {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/callCenter");        // 回收问题和环保金问题        SysConfig recoverySysConfig = sysConfigService.selectByCode("recovery_question_code");        SysConfig recoveryGoldSysConfig = sysConfigService.selectByCode("recovery_gold_question_code");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("recoverySysConfig", recoverySysConfig);        modelAndView.addObject("status", status);        modelAndView.addObject("recoveryGoldSysConfig", recoveryGoldSysConfig);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 我的环保金     */    @RequestMapping("/myGoldRecovery")    public ModelAndView myGoldRecovery(HttpServletRequest request,@RequestParam(required = false) String memberId) throws IOException {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/myGoldRecovery");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        // 需要计算回收多少和消费多少        RecoveryRecord recoveryRecord = new RecoveryRecord();        recoveryRecord.setType("1");        recoveryRecord.setMemberId(memberId);        Double recoveryMoney = recoveryRecordService.selectAllCount(recoveryRecord);        recoveryRecord.setType("2");        Double consumeMoney = recoveryRecordService.selectAllCount(recoveryRecord);        modelAndView.addObject("recoveryMoney", recoveryMoney);        modelAndView.addObject("consumeMoney", consumeMoney);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 我的袋子     */    @RequestMapping("/mySack")    public ModelAndView mySack(HttpServletRequest request,@RequestParam(required = false) String memberId, @RequestParam(required = false) String sackStatus) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/mySack");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        if (StringUtils.isEmpty(sackStatus)) {            sackStatus = "";        }        modelAndView.addObject("sackStatus", sackStatus);        modelAndView.addObject("jSTicketShareResponse", Share(request));        return modelAndView;    }    /**     * 袋子详情     */    @RequestMapping("/mySackDetail")    public ModelAndView mySackDetail(HttpServletRequest request,@RequestParam(required = false) String memberId, String recordId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/mySackDetail");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        RecoverySackRecord sackRecord = recoverySackRecordService.selectByPrimaryKey(recordId);        if (sackRecord != null) {            sackRecord.setCreateTimeStr(DateUtil.formatDateTime(sackRecord.getCreateTime()));        }        modelAndView.addObject("sackRecord", sackRecord);        if (sackRecord != null && StringUtils.isNotEmpty(sackRecord.getMemberCoverId())) {            // 查询并设置名称            WebMember coverMember = webMemberService.selectByPrimaryKey(sackRecord.getMemberCoverId());            if (coverMember != null && StringUtils.isNotEmpty(coverMember.getNickName())) {                sackRecord.setMemberCoverNickName(BaseUtil.decodeBase64(coverMember.getNickName()));            }        }        if (sackRecord != null && StringUtils.equals(sackRecord.getStatus(), BaseConstant.RECOVERY_RECORD_STATUS_THREE)) {            // 详情            RecoverySackDetailVo recoverySackDetailVo = new RecoverySackDetailVo();            recoverySackDetailVo.setRemoveTag(BaseConstant.BASE_REMOVE_TAG_NORMAL);            recoverySackDetailVo.setRecordId(recordId);            List<RecoverySackDetail> sackDetailList = recoverySackDetailService.acceptList(recoverySackDetailVo);            // 计算金额            Double allPrice = 0.0d;            if (sackDetailList != null && sackDetailList.size() > 0) {                for (RecoverySackDetail sackDetail : sackDetailList) {                    if (StringUtils.isNotEmpty(sackDetail.getAllPrice())) {                        allPrice = allPrice + Double.parseDouble(sackDetail.getAllPrice());                    }                }            }            modelAndView.addObject("allPrice", allPrice);            modelAndView.addObject("sackDetailList", sackDetailList);        }        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    @RequestMapping("/myDoSackDetail")    public ModelAndView myDoSackDetail(HttpServletRequest request,@RequestParam(required = false) String memberId, String sackMemberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/myDoSackDetail");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        RecoverySackMember recoverySackMember = recoverySackMemberService.selectByPrimaryKey(sackMemberId);        String sackId = recoverySackMember.getSackId();        RecoverySack recoverySack = recoverySackService.selectByPrimaryKey(sackId);        modelAndView.addObject("recoverySack", recoverySack);        modelAndView.addObject("recoverySackMember", recoverySackMember);        // 未预约，需要将用户地址带过去        ShopAddress record = new ShopAddress();        record.setMemberId(memberId);        record.setType("1");        List<ShopAddress> shopAddressList = shopAddressService.select(record);        if (shopAddressList != null && shopAddressList.size() > 0) {            ShopAddress shopAddress = shopAddressList.get(0);            StringBuilder sb = new StringBuilder();            sb.append(shopAddress.getName())                    .append(shopAddress.getBuilding()).append("幢")                    .append(shopAddress.getUnit()).append("单元")                    .append(shopAddress.getRoom()).append("室");            modelAndView.addObject("address", sb.toString());        }        modelAndView.addObject("nowDate", DateUtil.formatDate(DateUtil.date()));        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 待处理袋子     */    @RequestMapping("/staffDoSack")    public ModelAndView staffDoSack(HttpServletRequest request, @RequestParam(required = false) String memberId, @RequestParam(required = false) String coverStatus) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/staffDoSack");        modelAndView.addObject("memberId", memberId);        if (StringUtils.isEmpty(coverStatus)) {            coverStatus = "";        }        modelAndView.addObject("coverStatus", coverStatus);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 待处理袋子详情     */    @RequestMapping("/staffDoSackDetail")    public ModelAndView staffDoSackDetail(HttpServletRequest request,@RequestParam(required = false) String memberId, String id) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/staffDoSackDetail");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        RecoverySackRecord sackRecord = recoverySackRecordService.selectByPrimaryKey(id);        if (sackRecord != null) {            sackRecord.setCreateTimeStr(DateUtil.formatDateTime(sackRecord.getCreateTime()));            if (sackRecord.getManageTime() != null) {                sackRecord.setManageTimeStr(DateUtil.formatDateTime(sackRecord.getManageTime()));            }        }        // 需要记录详情,表示已预约过了        modelAndView.addObject("sackRecord", sackRecord);        modelAndView.addObject("sackRecord", sackRecord);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 袋子绑定列表json     * 包括绑定信息及预约信息     */    @RequestMapping(value = "/recoveryMemberJsonList",method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoveryMemberJsonList(RecoverySackMemberVo recoverySackMemberVo, int pageSize, int pageNum) {        ReturnEntity returnEntity = recoverySackMemberService.pageLeft(recoverySackMemberVo, pageSize, pageNum);        return returnEntity;    }    /**     * 袋子记录表json     */    @RequestMapping(value = "/recoverySackRecordJsonList",method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoverySackRecordJsonList(RecoverySackRecordVo recoverySackRecordVo, int pageSize, int pageNum) {        ReturnEntity returnEntity = recoverySackRecordService.pageLeft(recoverySackRecordVo, pageSize, pageNum);        return returnEntity;    }    /**     * 购买袋子的json记录     */    @RequestMapping(value = "/recoveryBuySackJsonList",method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoveryBuySackJsonList(RecoveryOrderVo recoveryOrderVo, int pageSize, int pageNum) {        ReturnEntity returnEntity = recoveryOrderService.page(recoveryOrderVo, pageSize, pageNum);        return returnEntity;    }    /**     * 用户初次绑定袋子     */    @RequestMapping(value = "/recoverySackRecord/bindSack", method = RequestMethod.POST)    public @ResponseBody ReturnEntity bindSack(String memberId, String cardNo) {        return recoverySackMemberService.bindSack(memberId, cardNo);    }    /**     * 用户预约     * memberCoverId盘点人，即当前人     */    @RequestMapping(value = "/recoveryRecord/saveSackRecord",method = RequestMethod.POST)    public @ResponseBody ReturnEntity saveSackRecord(String id, String memberPhone, String memberAddress) {        return recoverySackMemberService.coverSack(id, memberPhone, memberAddress);    }    /**     * 员工上门处理回收物     * 更新状态等操作     */    @RequestMapping(value = "/recoveryRecord/updateSackRecord", method = RequestMethod.POST)    public @ResponseBody ReturnEntity updateSackRecord(RecoverySackRecordVo recoverySackRecordVo) {        return recoverySackRecordService.updateSackRecord(recoverySackRecordVo);    }    /**     * 环保金记录     */    @RequestMapping(value = "/recoveryRecordJsonList",method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoveryRecordJsonList(RecoveryRecordVo recoveryRecordVo, int pageSize, int pageNum) {        ReturnEntity returnEntity = recoveryRecordService.page(recoveryRecordVo, pageSize, pageNum);        return returnEntity;    }    /**     * 商城     */    @RequestMapping("/shop")    public ModelAndView shop(HttpServletRequest request,@RequestParam(required = false) String memberId) throws IOException {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        // 获取商品分类        List<ShopItemCat> shopItemCatList = ehCacheService.selectShopItemCatList();        ModelAndView modelAndView = new ModelAndView("/mobile/shop");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("shopItemCatList", shopItemCatList);        // 选中第一个分类下商品        List<ShopItem> shopItemList = new ArrayList<ShopItem>();        if (shopItemCatList != null && shopItemCatList.size() > 0) {            String catId = shopItemCatList.get(0).getId();            ShopItem shopItemRecord = new ShopItem();            shopItemRecord.setCatId(catId);            shopItemList = shopItemService.select(shopItemRecord);        }        if(shopItemCatList!=null&&shopItemCatList.size()>0){            modelAndView.addObject("currentCatId", shopItemCatList.get(0).getId());        }        modelAndView.addObject("shopItemList", shopItemList);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 购买袋子的记录     */    @RequestMapping("/myBuySack")    public ModelAndView myBuySack(HttpServletRequest request,@RequestParam(required = false) String memberId) {        ModelAndView modelAndView = new ModelAndView("/mobile/myBuySack");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 商品详情     */    @RequestMapping("/shopItemDetail")    public ModelAndView shopItemDetail(HttpServletRequest request,@RequestParam(required = false) String memberId, String id) {        ModelAndView modelAndView = new ModelAndView("/mobile/detail");        modelAndView.addObject("memberId", memberId);        ShopItem shopItem = shopItemService.selectByPrimaryKey(id);        modelAndView.addObject("shopItem", shopItem);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 文章详情     */    @RequestMapping("/webArticleDetail")    public ModelAndView webArticleDetail(HttpServletRequest request,@RequestParam(required = false) String memberId, String id) {        ModelAndView modelAndView = new ModelAndView("/mobile/article");        modelAndView.addObject("memberId", memberId);        WebArticle webArticle = webArticleService.selectByPrimaryKey(id);        // 需要详情        if (StringUtils.isNotEmpty(webArticle.getTypeId())) {            WebArticleType webArticleType = webArticleTypeService.selectByPrimaryKey(webArticle.getTypeId());            modelAndView.addObject("typeName", webArticleType.getName());        }        if (webArticle.getCreateTime() != null) {            modelAndView.addObject("createTime", DateUtil.format(webArticle.getCreateTime(), DatePattern.CHINESE_DATE_PATTERN));        }        modelAndView.addObject("webArticle", webArticle);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 扫码链接     * memberId扫描人     * useMemberId提供二维码的人     */    @RequestMapping("/debitNote")    public ModelAndView debitNote(HttpServletRequest request,@RequestParam(required = false) String memberId, String useMemberId) {        WebMember useWebMember = check(useMemberId, BaseConstant.WX_STATE_ONE);        if (useWebMember == null) {            return checkModelAndView;        }        // 查询扫描人是否有权限        WebMember webMember = webMemberService.selectByPrimaryKey(memberId);        // 获取商品分类        ModelAndView modelAndView = new ModelAndView("/mobile/debitNote");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("useMemberId", useMemberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 袋子二维码扫描链接     */    @RequestMapping("/recoverySackScan")    public ModelAndView recoverySackScan(HttpServletRequest request, @RequestParam(required = false) String memberId, String cardNo) {        // 查询扫描人是否有权限        WebMember webMember = webMemberService.selectByPrimaryKey(memberId);        if (webMember != null && StringUtils.isNotEmpty(webMember.getNickName())) {            webMember.setNickName(BaseUtil.decodeBase64(webMember.getNickName()));        }        ModelAndView modelAndView = new ModelAndView("/mobile/recoverySack");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("cardNo", cardNo);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 购买袋子     */    @RequestMapping("/buy")    public ModelAndView buy(HttpServletRequest request, @RequestParam(required = false) String memberId) {        ModelAndView modelAndView = new ModelAndView("/mobile/buy");        WebMember webMember = webMemberService.selectByPrimaryKey(memberId);        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 商品列表     */    @RequestMapping(value = "/shopItemJsonList",method = RequestMethod.POST)    public @ResponseBody JSONObject shopItemJsonList(ShopItem shopItem) {        List<ShopItem> shopItemList = shopItemService.select(shopItem);        JSONObject jsonObject = new JSONObject();        jsonObject.put("code", 0);        jsonObject.put("data", shopItemList);        return jsonObject;    }    /**     * 地址列表     */    @RequestMapping(value = "/webAddressJsonList",method = RequestMethod.POST)    public @ResponseBody JSONObject webAddressJsonList(WebAddress webAddress) {        webAddress.setRemoveTag(BaseConstant.BASE_REMOVE_TAG_NORMAL);        List<WebAddress> webAddressList = webAddressService.select(webAddress);        JSONObject jsonObject = new JSONObject();        jsonObject.put("code", 0);        jsonObject.put("data", webAddressList);        return jsonObject;    }    @RequestMapping(value = "/webAddressJsonNewList",method = RequestMethod.POST)    public @ResponseBody JSONObject webAddressJsonNewList(WebAddress webAddress) {        List<AddressDTO> addressList = new ArrayList<AddressDTO>();        webAddress.setRemoveTag(BaseConstant.BASE_REMOVE_TAG_NORMAL);        List<WebAddress> webAddressList = webAddressService.select(webAddress);        for(char a = 'A'; a <= 'Z'; a++) {            // 查询数据库，或者比较            List<AddressDataDTO> cityDataList = new ArrayList<AddressDataDTO>();            for (WebAddress entity : webAddressList) {                if (StringUtils.equals(entity.getLetter(), String.valueOf(a))) {                    cityDataList.add(new AddressDataDTO(entity.getId(), entity.getArea()));                }            }            addressList.add(new AddressDTO(String.valueOf(a), cityDataList));        }        JSONObject jsonObject = new JSONObject();        jsonObject.put("code", 0);        jsonObject.put("data", addressList);        return jsonObject;    }    /**     * 保存用户地址     */    @RequestMapping(value = "/webMember/saveAddress",method = RequestMethod.POST)    public @ResponseBody ReturnEntity saveWebAddress(String memberId, String addressId) {        WebMember webMember = new WebMember();        webMember.setId(memberId);        webMember.setAddressId(addressId);        int info = webMemberService.updateByPrimaryKeySelective(webMember);        if (info <= 0) {            return new ReturnEntity(BaseConstant.FAIL,BaseConstant.DO_FAIL);        }        return new ReturnEntity();    }    /**     * 呼叫页面     * 需要带出默认地址     * //todo 如果没有默认地址选择第一个，应该使用sql直接搞定     */    @RequestMapping("/callOut")    public ModelAndView callOut(HttpServletRequest request,@RequestParam(required = false) String memberId, String largeCatId) {        ModelAndView modelAndView = new ModelAndView("/mobile/callOut");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("largeCatId", largeCatId);        modelAndView.addObject("jSTicketShareResponse",Share(request));        ShopAddress record = new ShopAddress();        record.setMemberId(memberId);        record.setType("1");        List<ShopAddress> shopAddressList = shopAddressService.select(record);        if (shopAddressList != null && shopAddressList.size() > 0) {            modelAndView.addObject("shopAddress", shopAddressList.get(0));        } /*else {            record.setType(null);            List<ShopAddress> shopAddressListT = shopAddressService.select(record);            if (shopAddressListT != null && shopAddressListT.size() > 0) {                modelAndView.addObject("shopAddress", shopAddressListT.get(0));            }        }*/        return modelAndView;    }    /**     * 保存呼叫     */    @RequestMapping(value = "/recoveryCallOut/save",method = RequestMethod.POST)    public @ResponseBody ReturnEntity saveRecoveryCallOut(RecoveryCallOutVo recoveryCallOutVo) {        RecoveryCallOut recoveryCallOut = new RecoveryCallOut();        BeanUtil.copyProperties(recoveryCallOutVo, recoveryCallOut);        recoveryCallOut.setId(BaseUtil.uId());        recoveryCallOut.setMemberName(BaseUtil.encodeBase64String(recoveryCallOutVo.getMemberName()));        recoveryCallOut.setCreateTime(new Date());        recoveryCallOut.setUpdateTime(new Date());        // 保存手机号        if (StringUtils.isNotEmpty(recoveryCallOutVo.getMemberPhone())) {            WebMember webMember = webMemberService.selectByPrimaryKey(recoveryCallOutVo.getMemberId());            webMember.setPhone(recoveryCallOutVo.getMemberPhone());            webMember.setUpdateTime(new Date());            webMemberService.updateByPrimaryKeySelective(webMember);        }        int info = recoveryCallOutService.insert(recoveryCallOut);        if (info <= 0) {            return new ReturnEntity(BaseConstant.FAIL,BaseConstant.DO_FAIL);        }        return new ReturnEntity();    }    /**     * 保存建议     */    @RequestMapping(value = "/recoveryPropose/save",method = RequestMethod.POST)    public @ResponseBody ReturnEntity saveRecoveryPropose(RecoveryProposeVo recoveryProposeVo) {        RecoveryPropose recoveryPropose = new RecoveryPropose();        BeanUtil.copyProperties(recoveryProposeVo, recoveryPropose);        recoveryPropose.setId(BaseUtil.uId());        WebMember webMember = webMemberService.selectByPrimaryKey(recoveryProposeVo.getMemberId());        recoveryPropose.setMemberName(webMember.getNickName());        recoveryPropose.setCreateTime(DateUtil.date());        recoveryPropose.setUpdateTime(recoveryPropose.getCreateTime());        int info = recoveryProposeService.insert(recoveryPropose);        if (info <= 0) {            return new ReturnEntity(BaseConstant.FAIL,BaseConstant.DO_FAIL);        }        return new ReturnEntity();    }    /**     * 保存记录     */    @RequestMapping(value = "/recoveryRecord/save",method = RequestMethod.POST)    public @ResponseBody ReturnEntity saveRecoveryRecord(RecoveryRecordVo recoveryRecordVo) {        return recoveryRecordService.saveRecoveryRecord(recoveryRecordVo);    }    /**     * 保存订单     */    @RequestMapping(value = "/recoveryOrder/save", method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoveryOrderSave(@RequestParam(required = false) String memberId, String num) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return new ReturnEntity(BaseConstant.FAIL, "您的用户信息有误，请重新进入");        }        RecoveryOrder recoveryOrder = new RecoveryOrder();        recoveryOrder.setId(BaseUtil.uId());        recoveryOrder.setRemoveTag(BaseConstant.BASE_REMOVE_TAG_NORMAL);        recoveryOrder.setMemberId(memberId);        recoveryOrder.setNum(Integer.parseInt(num));        recoveryOrder.setCreateTime(DateUtil.date());        recoveryOrder.setUpdateTime(DateUtil.date());        int info = recoveryOrderService.insert(recoveryOrder);        if (info > 0) {            return new ReturnEntity();        } else {            return new ReturnEntity(BaseConstant.FAIL, "购买错误");        }    }    @RequestMapping("/shopAddressList")    public ModelAndView shopAddressList(HttpServletRequest request,@RequestParam(required = false) String memberId, @RequestParam(required = false) String status) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/address");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        ShopAddress shopAddress = new ShopAddress();        shopAddress.setMemberId(memberId);        List<ShopAddress> addressList = shopAddressService.select(shopAddress);        modelAndView.addObject("addressList", addressList);        modelAndView.addObject("status", status);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    @RequestMapping("/shopAddressEdit")    public ModelAndView shopAddressEdit(HttpServletRequest request,@RequestParam(required = false) String memberId,            @RequestParam(required = false) String addressId, @RequestParam(required = false) String status) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/addAddress");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("webMember", webMember);        modelAndView.addObject("status", status);        ShopAddress shopAddress = shopAddressService.selectByPrimaryKey(addressId);        modelAndView.addObject("shopAddress", shopAddress);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    @RequestMapping(value = "/delAddressEntity",method = RequestMethod.POST)    public @ResponseBody ReturnEntity delAddressEntity(String memberId, String addressId) {        int info = shopAddressService.deleteByPrimaryKey(addressId);        if (info > 0) {            return new ReturnEntity();        } else {            return new ReturnEntity(BaseConstant.FAIL, "删除错误");        }    }    /**     * 设置默认地址，将其他地址设置为非默认     */    @RequestMapping(value = "/setAddressDefault",method = RequestMethod.POST)    public @ResponseBody ReturnEntity setAddressDefault(String memberId, String addressId) {        ReturnEntity returnEntity = shopAddressService.setAddressDefault(memberId,addressId);        return returnEntity;    }    /**     * 保存地址     */    @RequestMapping(value = "/updateOrAddAddress",method = RequestMethod.POST)    public @ResponseBody ReturnEntity updateOrAddAddress(ShopAddressVo shopAddressVo) {        ReturnEntity returnEntity = shopAddressService.updateOrAddAddress(shopAddressVo);        return returnEntity;    }    /**     * 商城地址json数据     */    @RequestMapping(value = "/shopAddressJsonList",method = RequestMethod.POST)    public @ResponseBody ReturnEntity shopAddressJsonList(ShopAddressVo shopAddressVo, int pageSize, int pageNum) {        ReturnEntity returnEntity = shopAddressService.page(shopAddressVo, pageSize, pageNum);        return returnEntity;    }    /**     * 提现模块     */    @RequestMapping("/tixianList")    public ModelAndView tixianList(HttpServletRequest request,@RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/tixianList");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("member", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 提现保存页面     */    @RequestMapping("/tixian")    public ModelAndView tixian(HttpServletRequest request, @RequestParam(required = false) String memberId) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return checkModelAndView;        }        ModelAndView modelAndView = new ModelAndView("/mobile/tixian");        modelAndView.addObject("memberId", memberId);        modelAndView.addObject("member", webMember);        modelAndView.addObject("jSTicketShareResponse",Share(request));        return modelAndView;    }    /**     * 提现保存，修改的是积分     */    @RequestMapping(value = "/tianxianUpdate",method = RequestMethod.POST)    public @ResponseBody ReturnEntity updateOrAddEntity(@RequestParam(required = false) String memberId, String status, String money) {        WebMember webMember = check(memberId, BaseConstant.WX_STATE_ONE);        if (webMember == null) {            return new ReturnEntity(BaseConstant.FAIL, "您的用户信息有误，请重新进入");        }        return shopWithdrawService.withdrawEdit(webMember, status, money);    }    /**     * 提现json数据     */    @RequestMapping(value = "/tixianCurrentJsonList", method = RequestMethod.POST)    public @ResponseBody ReturnEntity tixianCurrentJsonList(ShopWithdrawVo shopWithdraw, int pageSize, int pageNum) {        ReturnEntity returnEntity = shopWithdrawService.pageLeft(shopWithdraw, pageSize, pageNum);        return returnEntity;    }    /**     * 下单保存     */    @RequestMapping(value = "/recoveryCircleOrderSave",method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoveryCircleOrderSave(RecoveryCircleOrderVo recoveryCircleOrderVo) {        ReturnEntity returnEntity = recoveryCircleOrderService.addOrUpdate(recoveryCircleOrderVo);        WebMember webMember=webMemberService.selectByPrimaryKey(recoveryCircleOrderVo.getMemberId());        if(webMember!=null){            webMember.setPhone(recoveryCircleOrderVo.getPhone());            webMember.setAddressName(recoveryCircleOrderVo.getAddress());            webMemberService.updateByPrimaryKey(webMember);        }        return returnEntity;    }    /**     * 取消订单     */    @RequestMapping(value = "/recoveryCircleOrderDelete",method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoveryCircleOrderDelete(String id) {        ReturnEntity returnEntity =recoveryCircleOrderService.delete(id,null);        return returnEntity;    }    /**     * 回收员确认订单     */    @RequestMapping(value = "/recoveryCircleOrderUpdateStatus",method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoveryCircleOrderUpdateStatus(String id, String status,String price,String content) {        RecoveryCircleOrder recoveryCircleOrder = recoveryCircleOrderService.selectByPrimaryKey(id);        recoveryCircleOrder.setStatus(status);        recoveryCircleOrder.setPrice(price);        recoveryCircleOrder.setContent(content);        recoveryCircleOrderService.updateByPrimaryKey(recoveryCircleOrder);        // 需要记录提现。下单，暂无积分奖赏        WebMember webMember=webMemberService.selectByPrimaryKey(recoveryCircleOrder.getMemberId());        webMember.setMoney(webMember.getMoney()+Double.parseDouble(recoveryCircleOrder.getPrice()));        webMemberService.updateByPrimaryKey(webMember);        // 积分记录表        RecoveryRecord recoveryRecord = new RecoveryRecord();        recoveryRecord.setId(BaseUtil.uId());        recoveryRecord.setMemberId(recoveryCircleOrder.getMemberId());        recoveryRecord.setMoney(recoveryCircleOrder.getPrice());        recoveryRecord.setDescription(String.format("回收订单增加%s元", recoveryCircleOrder.getPrice()));        recoveryRecord.setCreateTime(DateUtil.date());        recoveryRecord.setRemoveTag(BaseConstant.BASE_REMOVE_TAG_NORMAL);        recoveryRecord.setUpdateTime(recoveryRecord.getCreateTime());        recoveryRecord.setType(BaseConstant.RECORD_STATUS_ADD_SCORE);        recoveryRecordService.insert(recoveryRecord);        return new ReturnEntity();    }    /**     * 下单列表json数据     */    @RequestMapping(value = "/recoveryCircleOrderCurrentJsonList", method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoveryCircleOrderCurrentJsonList(RecoveryCircleOrderVo recoveryCircleOrderVo, int pageSize, int pageNum) {        ReturnEntity returnEntity = recoveryCircleOrderService.page(recoveryCircleOrderVo, pageSize, pageNum);        return returnEntity;    }    /**     * 加入收废员保存     */    @RequestMapping(value = "/recoveryWasteMemberSave",method = RequestMethod.POST)    public @ResponseBody ReturnEntity recoveryWasteMemberSave(RecoveryWasteMemberVo recoveryWasteMemberVo) {        ReturnEntity returnEntity = recoveryWasteMemberService.addOrUpdate(recoveryWasteMemberVo);        return returnEntity;    }    /**     * 上传附件     */    @RequestMapping(value = "/sysFile/singleFile",method = RequestMethod.POST)    public @ResponseBody ReturnEntity singleFile(MultipartFile file, HttpServletRequest request, String catalog, String requestFileType, String objectId, String isSave){        return sysFileService.fileUpload(file,request,catalog,requestFileType,objectId,isSave);    }    /**     * 根据经纬度获取地址     */    @RequestMapping(value = "/acceptAddres")    public @ResponseBody ReturnEntity acceptAddres(String location) {        try {            JSONObject address= GaoDeApi.acceptAddress(location);            return new ReturnEntity(address);        } catch (Exception e) {            e.printStackTrace();        }        return new ReturnEntity(BaseConstant.FAIL,"获取失败");    }    /**     * 通用验证     * */    protected WebMember check(String id, String state){        if (StringUtil.isNotEmpty(id)) {            WebMember webMember = webMemberService.selectByPrimaryKey(id);            if (webMember != null) {                //设置会员昵称                if (StringUtil.isNotEmpty(webMember.getNickName())) {                    webMember.setNickName(BaseUtil.decodeBase64(webMember.getNickName()));                }                return webMember;            }        }        checkModelAndView = new ModelAndView("redirect:"+ ProProperties.getInstance().getWxOauthURL(state));        return null;    }    /**     * 通用分享可设置     * */    protected JSTicketShareResponse Share(HttpServletRequest request){        WebAccount wxAccountInfo= WxMemoryCacheClient.getSingleWxAccountInfo();        log.info("phone:"+wxAccountInfo.toString());        String url= wxAccountInfo.getBaseUrl()+request.getServletPath();        String c=request.getQueryString();        if(StringUtil.isNotEmpty(c)){            url=url+"?"+c;        }        //设置js分享        JSTicketShareResponse jsTicketShareResponse = WxApiClient.getJSTicketShareResponse(url);        log.info("phone:"+jsTicketShareResponse);        List<WebShare> webShareList=webShareService.acceptList(new WebShareVo());        if(webShareList!=null&&webShareList.size()>0){             WebShare dbShare=webShareList.get(0);            if(dbShare!=null&&jsTicketShareResponse!=null){                jsTicketShareResponse.setFxTitle(dbShare.getShareTitle());                jsTicketShareResponse.setFxImgUrl(wxAccountInfo.getBaseUrl()+ dbShare.getSharePic());                jsTicketShareResponse.setFxDesc(dbShare.getShareDesc());                jsTicketShareResponse.setFxUrl(dbShare.getShareUrl());                jsTicketShareResponse.setAppid(wxAccountInfo.getAppId());            }        }        return jsTicketShareResponse;    }    /**     * 小程序获取用户信息     * */    @RequestMapping(value = "/xcxAcceptUserInfo")    public @ResponseBody    Map<String,Object> xcxAcceptUserInfo(String code){        Map<String,Object> map=WxApiClient.xcxAcceptUserInfo(code);        String unionid=(String)map.get("unionid");        String xcxOpenid=(String)map.get("openid");        if(StringUtil.isNotEmpty(unionid)&&StringUtil.isNotEmpty(xcxOpenid)){            setXcxOpenid(unionid,xcxOpenid);        }        WebAccount webAccount= WxMemoryCacheClient.getSingleWxAccountInfo();        List<WebShare> webShareList=webShareService.acceptList(new WebShareVo());        if(webShareList!=null&&webShareList.size()>0){            WebShare dbShare=webShareList.get(0);            if(dbShare!=null){                map.put("title", dbShare.getShareTitle());                map.put("desc",dbShare.getShareDesc());                map.put("imageUrl",webAccount.getBaseUrl()+ dbShare.getSharePic());            }        }        return map;    }    private void setXcxOpenid(String unionid,String xcxOpenid){        WebUnionid webUnionid= webUnionidService.selectByPrimaryKey(unionid);        if(webUnionid!=null&&!(xcxOpenid.equals(webUnionid.getXcxOpenid()))){            webUnionid.setXcxOpenid(xcxOpenid);            webUnionidService.updateByPrimaryKey(webUnionid);        }else if(webUnionid==null){            webUnionid=new WebUnionid();            webUnionid.setUnionid(unionid);            webUnionid.setXcxOpenid(xcxOpenid);            webUnionid.setCreateTime(new Date());            webUnionidService.insert(webUnionid);        }    }}